<template>
	<view>
				<view class="model-box">
					<view class="model-item sale" @click="jump('purchaseNo')">
							<view class="mark">{{noSingleNum}}</view>
						<image class="model-icon" src="/static/image/index/noSingle.png" mode="aspectFit">
						</image>
						<view class="model-text">
							无单收货
						</view>
					</view>
					<view class="model-item buy" @click="jump('materialIn')">
						<view class="mark">{{materialInNum}}</view>
						<image class="model-icon" src="/static/image/index/Warehousing.png" mode="aspectFit">
						</image>
						<view class="model-text">
							物料入库
						</view>
					</view>
					<view class="model-item home" @click="jump('materialOut')">
						<view class="mark">{{materialOutNum}}</view>
						<image class="model-icon" src="/static/image/index/checkout.png" mode="aspectFit">
						</image>
						<view class="model-text">
							物料出库
						</view>
					</view>
					</view>
		
	</view>
</template>
<script>
	import * as api from '@/utils/api.js';
	export default {
		data() {
			return {
				noSingleNum:'',
				materialInNum:'',
				materialOutNum:'',
			}
		},
		mounted() {
			this.newsNum()
		},
		methods: {
			newsNum(){
				api.storageNews().then(res => {
					if (res.code == 0) {
						console.log('nnnn',res)
						let data=res.data
						this.noSingleNum=Number(data.notPurOrder.kind)+Number(data.acceptNotOutsource.kind)+Number(data.notOutsourceOrder.kind)
						console.log('nnnnn--->',this.noSingleNum)
						this.materialInNum=Number(data.production.kind)+Number(data.purchase.kind)+Number(data.acceptNotOutsource.kind)+Number(data.entrustOutsource.kind)+Number(data.productionBack.kind)+Number(data.orderBack.kind)+Number(data.allotIn.kind)
							console.log('2222-2-->',this.materialInNum)
							this.materialOutNum=Number(data.purchaseBack.kind)+Number(data.productionOut.kind)+Number(data.acceptOutsourceOut.kind)+Number(data.outsourceOut.kind)+Number(data.order.kind)+Number(data.allotOut.kind)
							console.log('9992-2-->',this.materialOutNum)
					}
					})
			},
			jump: function(name) {
				 if(name == 'purchaseNo'){
						uni.navigateTo({
							url: '/subcontractList/storage/purchaseNo/purchaseNo'
						});
					}else if(name == 'materialIn'){
						uni.navigateTo({
							url: '/subcontractList/storage/materialIn/materialIn'
						});
					}else if(name == 'materialOut'){
						uni.navigateTo({
							url: '/subcontractList/storage/materialOut/materialOut'
						});
					}else{
						uni.showToast({
							title: '该功能暂未开放',
							icon: 'none',
							duration: 2000
						});
					}
					
				},
			
		}
	}
</script>

<style lang="scss" scoped>
.model-box {
		width: calc(100% - 50rpx);
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
		margin: 0 25rpx;
		margin-top: 3vh;
		border-radius: 10rpx;
		overflow: hidden;

		.model-item {
			width: calc(34% - 15rpx);
			height: 20vh;
			margin-bottom: 10rpx;	
			border-radius: 10rpx;
			.model-icon {
				width: 40%;
				height: 40%;
				display: block;
				margin: 0 auto;
				margin-top:6%;
			}
			.mark{
				 z-index: 9999;
				  width: 60rpx;
				  height: 35rpx;
				  color: white;
				  border-radius: 16rpx;
				  background: red;
				  font-size: 24rpx;
				  display: flex;
				  justify-content: center;
				  align-items: center;
				  position: relative;
				  top: 40rpx;
				  left: 130rpx;
				  
			}

			.model-text {
				text-align: center;
				color: white;
				line-height: 80rpx;
				font-size: 30rpx;
			}
		}

		.model-item:nth-child(2n) {
			margin-right: 0;
		}

		.sale {
			background-color: #efc561;
		}

		.buy {
			background-color: #95e071;
		}

		.home {
			background-color: #d3a87b;
		}

	}
</style>
